import Vue from 'vue'
import Router from 'vue-router'
import MainContainer from '../menu/index.vue';
import TxMainContainer from '../view/index.vue';
import base from '../base/base';
import  VueResource  from 'vue-resource'

Vue.use(VueResource) 
Vue.use(Router);
Vue.use(base);

const menu={
  path: '/menu',
  name: 'menu',
  component:MainContainer,
  children:[
    {
      path:'category',
      name:'category',
      component: (resolve) => require(['../menu/category.vue'], resolve)
    },
    {
      path:'list',
      name:'list',
      component: (resolve) => require(['../menu/list.vue'], resolve)
    },
    {
      path:'editor',
      name:'editor',
      component: (resolve) => require(['../menu/editor.vue'], resolve)
    }
  ]
}

const tx_index={
  path:'/',
  name:'index',
  component: TxMainContainer,
  redirect:"/home",
  children:[
    {
      path:'home',
      name:'home',
      component: (resolve) => require(['../view/list.vue'], resolve)
    },
    {
      path:'view',
      name:'article_view',
      component: (resolve) => require(['../view/view.vue'], resolve)
    },
  ]
}

export default new Router({
  routes: [
    menu,
    tx_index
  ]
})
